package com.example.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.web3j.protocol.Web3j;
import org.web3j.protocol.http.HttpService;

/**
 * Web3j 配置类，自动装配 Web3j Bean
 */
@Configuration
public class Web3jConfig {
    @Value("${web3j.client.url}")
    private String web3jClientUrl;

    @Bean
    public Web3j web3j() {
        return Web3j.build(new HttpService(web3jClientUrl));
    }
}
